Trò chơi Angry Birds trong UNITY Engine
31.705 lượt xem;
- GoKitTweenExtensions.cs
- extensions /
- GoKit /
- Plugins /
- Assets /
- project /
1 using UnityEngine;
2 using System.Collections;
3
4
5 public static class GoKitTweenExtensions
6 {
7 #region Transform extensions
8
9 // to tweens
10 public static GoTween rotationTo( this Transform self, float duration, Vector3 endValue, bool isRelative = false )
11 {
12 return Go.to( self, duration, new GoTweenConfig().rotation( endValue, isRelative ) );
13 }
14
15
16 public static GoTween localRotationTo( this Transform self, float duration, Vector3 endValue, bool isRelative = false )
17 {
18 return Go.to( self, duration, new GoTweenConfig().localRotation( endValue, isRelative ) );
19 }
20
21
22 public static GoTween eulerAnglesTo( this Transform self, float duration, Vector3 endValue, bool isRelative = false )
23 {
24 return Go.to( self, duration, new GoTweenConfig().eulerAngles( endValue, isRelative ) );
25 }
26
27
28 public static GoTween localEulerAnglesTo( this Transform self, float duration, Vector3 endValue, bool isRelative = false )
29 {
30 return Go.to( self, duration, new GoTweenConfig().localEulerAngles( endValue, isRelative ) );
31 }
32
33
34 public static GoTween positionTo( this Transform self, float duration, Vector3 endValue, bool isRelative = false )
35 {
36 return Go.to( self, duration, new GoTweenConfig().position( endValue, isRelative ) );
37 }
38
39
40 public static GoTween localPositionTo( this Transform self, float duration, Vector3 endValue, bool isRelative = false )
41 {
42 return Go.to( self, duration, new GoTweenConfig().localPosition( endValue, isRelative ) );
43 }
44
45
46 public static GoTween scaleTo( this Transform self, float duration, float endValue, bool isRelative = false )
47 {
48 return self.scaleTo( duration, new Vector3( endValue, endValue, endValue ), isRelative );
49 }
50
51
52 public static GoTween scaleTo( this Transform self, float duration, Vector3 endValue, bool isRelative = false )
53 {
54 return Go.to( self, duration, new GoTweenConfig().scale( endValue, isRelative ) );
55 }
56
57
58 public static GoTween shake( this Transform self, float duration, Vector3 shakeMagnitude, GoShakeType shakeType = GoShakeType.Position, int frameMod = 1, bool useLocalProperties = false )
59 {
60 return Go.to( self, duration, new GoTweenConfig().shake( shakeMagnitude, shakeType, frameMod, useLocalProperties ) );
61 }
62
63
64 // from tweens
65 public static GoTween rotationFrom( this Transform self, float duration, Vector3 endValue, bool isRelative = false )
66 {
67 return Go.from( self, duration, new GoTweenConfig().rotation( endValue, isRelative ) );
68 }
69
70
71 public static GoTween localRotationFrom( this Transform self, float duration, Vector3 endValue, bool isRelative = false )
72 {
73 return Go.from( self, duration, new GoTweenConfig().localRotation( endValue, isRelative ) );
74 }
75
76
77 public static GoTween eulerAnglesFrom( this Transform self, float duration, Vector3 endValue, bool isRelative = false )
78 {
79 return Go.from( self, duration, new GoTweenConfig().eulerAngles( endValue, isRelative ) );
80 }
81
82
83 public static GoTween localEulerAnglesFrom( this Transform self, float duration, Vector3 endValue, bool isRelative = false )
84 {
85 return Go.from( self, duration, new GoTweenConfig().localEulerAngles( endValue, isRelative ) );
86 }
87
88
89 public static GoTween positionFrom( this Transform self, float duration, Vector3 endValue, bool isRelative = false )
90 {
91 return Go.from( self, duration, new GoTweenConfig().position( endValue, isRelative ) );
92 }
93
94
95 public static GoTween localPositionFrom( this Transform self, float duration, Vector3 endValue, bool isRelative = false )
96 {
97 return Go.from( self, duration, new GoTweenConfig().localPosition( endValue, isRelative ) );
98 }
99
100
101 public static GoTween scaleFrom( this Transform self, float duration, Vector3 endValue, bool isRelative = false )
102 {
103 return Go.from( self, duration, new GoTweenConfig().scale( endValue, isRelative ) );
104 }
105
106 #endregion
107
108
109 #region Material extensions
110
111 public static GoTween colorTo( this Material self, float duration, Color endValue, string colorName = "_Color" )
112 {
113 return Go.to( self, duration, new GoTweenConfig().materialColor( endValue, colorName ) );
114 }
115
116
117 public static GoTween colorFrom( this Material self, float duration, Color endValue, string colorName = "_Color" )
118 {
119 return Go.from( self, duration, new GoTweenConfig().materialColor( endValue, colorName ) );
120 }
121
122 #endregion
123
124 }
2 using System.Collections;
3
4
5 public static class GoKitTweenExtensions
6 {
7 #region Transform extensions
8
9 // to tweens
10 public static GoTween rotationTo( this Transform self, float duration, Vector3 endValue, bool isRelative = false )
11 {
12 return Go.to( self, duration, new GoTweenConfig().rotation( endValue, isRelative ) );
13 }
14
15
16 public static GoTween localRotationTo( this Transform self, float duration, Vector3 endValue, bool isRelative = false )
17 {
18 return Go.to( self, duration, new GoTweenConfig().localRotation( endValue, isRelative ) );
19 }
20
21
22 public static GoTween eulerAnglesTo( this Transform self, float duration, Vector3 endValue, bool isRelative = false )
23 {
24 return Go.to( self, duration, new GoTweenConfig().eulerAngles( endValue, isRelative ) );
25 }
26
27
28 public static GoTween localEulerAnglesTo( this Transform self, float duration, Vector3 endValue, bool isRelative = false )
29 {
30 return Go.to( self, duration, new GoTweenConfig().localEulerAngles( endValue, isRelative ) );
31 }
32
33
34 public static GoTween positionTo( this Transform self, float duration, Vector3 endValue, bool isRelative = false )
35 {
36 return Go.to( self, duration, new GoTweenConfig().position( endValue, isRelative ) );
37 }
38
39
40 public static GoTween localPositionTo( this Transform self, float duration, Vector3 endValue, bool isRelative = false )
41 {
42 return Go.to( self, duration, new GoTweenConfig().localPosition( endValue, isRelative ) );
43 }
44
45
46 public static GoTween scaleTo( this Transform self, float duration, float endValue, bool isRelative = false )
47 {
48 return self.scaleTo( duration, new Vector3( endValue, endValue, endValue ), isRelative );
49 }
50
51
52 public static GoTween scaleTo( this Transform self, float duration, Vector3 endValue, bool isRelative = false )
53 {
54 return Go.to( self, duration, new GoTweenConfig().scale( endValue, isRelative ) );
55 }
56
57
58 public static GoTween shake( this Transform self, float duration, Vector3 shakeMagnitude, GoShakeType shakeType = GoShakeType.Position, int frameMod = 1, bool useLocalProperties = false )
59 {
60 return Go.to( self, duration, new GoTweenConfig().shake( shakeMagnitude, shakeType, frameMod, useLocalProperties ) );
61 }
62
63
64 // from tweens
65 public static GoTween rotationFrom( this Transform self, float duration, Vector3 endValue, bool isRelative = false )
66 {
67 return Go.from( self, duration, new GoTweenConfig().rotation( endValue, isRelative ) );
68 }
69
70
71 public static GoTween localRotationFrom( this Transform self, float duration, Vector3 endValue, bool isRelative = false )
72 {
73 return Go.from( self, duration, new GoTweenConfig().localRotation( endValue, isRelative ) );
74 }
75
76
77 public static GoTween eulerAnglesFrom( this Transform self, float duration, Vector3 endValue, bool isRelative = false )
78 {
79 return Go.from( self, duration, new GoTweenConfig().eulerAngles( endValue, isRelative ) );
80 }
81
82
83 public static GoTween localEulerAnglesFrom( this Transform self, float duration, Vector3 endValue, bool isRelative = false )
84 {
85 return Go.from( self, duration, new GoTweenConfig().localEulerAngles( endValue, isRelative ) );
86 }
87
88
89 public static GoTween positionFrom( this Transform self, float duration, Vector3 endValue, bool isRelative = false )
90 {
91 return Go.from( self, duration, new GoTweenConfig().position( endValue, isRelative ) );
92 }
93
94
95 public static GoTween localPositionFrom( this Transform self, float duration, Vector3 endValue, bool isRelative = false )
96 {
97 return Go.from( self, duration, new GoTweenConfig().localPosition( endValue, isRelative ) );
98 }
99
100
101 public static GoTween scaleFrom( this Transform self, float duration, Vector3 endValue, bool isRelative = false )
102 {
103 return Go.from( self, duration, new GoTweenConfig().scale( endValue, isRelative ) );
104 }
105
106 #endregion
107
108
109 #region Material extensions
110
111 public static GoTween colorTo( this Material self, float duration, Color endValue, string colorName = "_Color" )
112 {
113 return Go.to( self, duration, new GoTweenConfig().materialColor( endValue, colorName ) );
114 }
115
116
117 public static GoTween colorFrom( this Material self, float duration, Color endValue, string colorName = "_Color" )
118 {
119 return Go.from( self, duration, new GoTweenConfig().materialColor( endValue, colorName ) );
120 }
121
122 #endregion
123
124 }